<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统登录</title>
<link type="text/css" href="${pageContext.request.contextPath}/assets/css/common.css" rel="stylesheet" />
<link type="text/css" href="${pageContext.request.contextPath}/assets/plugins/jquery-easyui-1.4.2/themes/metro/easyui.css" rel="stylesheet" />
<link type="text/css" href="${pageContext.request.contextPath}/assets/plugins/jquery-easyui-1.4.2/themes/mobile.css" rel="stylesheet" />	
<style type="text/css">
.loginbody{
	background:#267cb7;
	text-align:center;
}
.login-logo{
	background-size:100%;
	color:#fff;
	width:200px;
}
.login-logo span{
	color:#FF3F3F;
}

</style>
</head>
<body class="loginbody">
	<div class="login-wrap">
		<div class="login-logo"><span>CTMS-</span>临床试验管理系统</div>
		<div class="login-form">
			<div class="col">
				<input type="text" id="txtUserName" class="login-input" placeholder="用户名" /> <label
					class="icon user" ></label>
			</div>
			<div class="col">
				<input type="password" id="txtPassword" class="login-input" placeholder="密码" /> <label
					class="icon pwd" ></label>
			</div>
			<div class="col">
				<button class="login-btn" id="loginBtn" onclick="dologin()">登 录</button>
			</div>
		</div>
		<div class="login-tips">
			<i></i>
			<p id="msgtip" runat="server">请输入用户名和密码</p>
		</div>
	</div>

	<div class="copy-right">
		<p>版权所有 蚌埠医学院第一附属医院 Copyright © 2016 - 2017
			Rights Reserved.</p>
	</div>
	
	<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/assets/js/jquery-1.11.2.min.js" ></script>
	<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/assets/plugins/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/assets/plugins/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript">
	var contextPath = '<%=request.getContextPath()%>';
	$(function(){
		$(document).keyup(function(event){
			  if(event.keyCode ==13){
				    var usernameInput = document.getElementById("txtUserName");
		            var passwordInput = document.getElementById("txtPassword");
		            var loginBtn = document.getElementById("loginBtn");
		            if (usernameInput == document.activeElement) {
		                passwordInput.focus();
		                return;
		            } else if (passwordInput == document.activeElement) {
		                loginBtn.click();
		                return;
		            }
			  }
		});
	})
	//登录
	function dologin(){
		var userName=$('#txtUserName').val();
		var passWord=$('#txtPassword').val();
		if(userName=='' || userName==null ||userName=='undefined'){
  			$.messager.show({title:'提示',msg:'用户名不能为空！',showType:'slide'});
  			$('#txtUserName').focus();
			return;
		}
		if(passWord=='' || passWord==null ||passWord=='undefined'){
			$.messager.show({title:'提示',msg:'密码不能为空！',showType:'slide'});
			$('#txtPassword').focus();
			return;
		}
		$.ajax({
			url : contextPath + "/bg/U101.do",
			data : {"userName":encodeURI(userName),"passWord":passWord,"rnd":Math.random()},
			dataType : 'json',
			success : function(data, textStatus, jqXHR) {
				if(data.code=='0'){
					var code=data.result.CODE;
					location.href=contextPath+"/bg/index.do?code="+code+"&rnd="+Math.random();
				}else{
		  			$.messager.show({title:'提示',msg:data.msg,showType:'slide'});
		  			$('#txtUserName').focus();
				}
			}
		})
	}
	</script>
</body>
</html>